package java_objects.static_modifier;

public class VariableTest {

	public static void main(String[] args) {
		
		// You can access static variable without instantiation
		// right use
		System.out.println(Variable.a);

		// You can also access static variable with object
		// wrong use
		System.out.println(new Variable().a);
		// Warning :
		// The static field Variable.a should be accessed in a static way

		// The only way to access instance variable is through Object
		System.out.println(new Variable().b);

		// Uncomment following to see compiler error
		// error:
		// System.out.println(Variable.b);
		// Cannot make a static reference
		// to the non-static field Variable.b
	}

}
